# 分牌
N=int(input())
lt=list(map(int,input().split()))
sum=sum(lt)
avg=sum/N
count=0
for i in range(N):
    lt[i]=lt[i]-avg
for i in range(N-1):
    if lt[i] !=0:
        lt[i+1]=lt[i]+lt[i+1]
        lt[i]=0
        count+=1
print(count)